<template>
  <div class="tabs">
    <div class="tab cur" :class="{active:active==item.id}" @click="getactive(item.id)" v-for="(item,index) in list"
         :key="index"><span>{{ item.name }}</span>
    </div>
  </div>
</template>
<script>
export default {
  name: 'tabs',
  components: {},
  props: {
    list: {
      type: Array,
      default () {
        return []
      }
    },
    active: {
      type: [Number, String],
      default () {
        return 0
      }
    }
  },
  data () {
    return {}
  },
  watch: {},
  mounted () {
  },
  methods: {
    getactive (e) {
      this.$emit('update:active', e)
    }
  }
}
</script>
<style scoped lang="scss">
.tabs {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  flex-direction: row;
  width: calc(100% - 0px);
  margin: 0px auto;
  .tab {
    width: 100px;
    height: 36px;
    background: url("./assets/tabbg.png") center center no-repeat;
    background-size: 100% 100%;
    opacity: 1;
    display: flex;
    cursor: pointer;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    flex-direction: row;
    align-content: flex-start;

    span {
      font-size: 14px;
      font-family: PingFang SC-Medium, PingFang SC;
      font-weight: 500;
      color: #00B2FF;
    }

  }

  .tab.active {
    width: 100px;
    height: 36px;
    background: url("./assets/tabbgActive.png") center center no-repeat;
    background-size: 100% 100%;
    opacity: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    flex-direction: row;
    align-content: flex-start;

    span {
      font-size: 16px;
      font-family: PingFang SC-Bold, PingFang SC;
      font-weight: bold;
      color: #031B2F;
    }
  }
}
</style>
